﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Statistics.aspx.vb" Inherits="Nokia_Smartphones.Statistics" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            font-size: x-large;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        <strong><span class="style1">Site Summary</span></strong>
    </p>
    <p>
        <strong>Most Active Users</strong>
    </p>
    <p>
        Hurry !! Contrbute more and be popular !<br />
        <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1">
            <series>
                <asp:Series Name="Series1" XValueMember="Author" YValueMembers="NumComments" 
                    ChartType="Doughnut">
                </asp:Series>
            </series>
            <chartareas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </chartareas>
        </asp:Chart>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:PhonesConn %>" 
            ProviderName="<%$ ConnectionStrings:PhonesConn.ProviderName %>" 
            SelectCommand="SELECT [Author], [NumComments] FROM [NumberComments]">
        </asp:SqlDataSource>
    </p>
    <p>
        <strong>Current Phone Rankings</strong></p>
    <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (By User Ratings)&nbsp;</strong></br>
        <asp:Chart ID="Chart2" runat="server" DataSourceID="SqlDataSource2">
            <series>
                <asp:Series Name="Series1" XValueMember="Model_Number" 
                    YValueMembers="AverageRating">
                </asp:Series>
            </series>
            <chartareas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </chartareas>
        </asp:Chart>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:PhonesConn %>" 
            ProviderName="<%$ ConnectionStrings:PhonesConn.ProviderName %>" 
            
        SelectCommand="SELECT DISTINCT Phones.Model_Number, AverageRating.AverageRating FROM (Phones INNER JOIN AverageRating ON Phones.ID = AverageRating.PhoneFkID)">
        </asp:SqlDataSource>
    </p>
    <p>
        <strong>Most Viewd Videos - YouTube</strong></p>
    <p>
        Top 5 vidwos</p>
    <p>

        &<asp:Chart ID="Chart3" runat="server" DataSourceID="SqlDataSource3" Width="536px">
            <Series>
                <asp:Series ChartArea="ChartArea1" Name="Series1" XValueMember="VideoTitle" YValueMembers="Total Views">
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </ChartAreas>
        </asp:Chart>

            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:PhonesConn %>"
            ProviderName="<%$ ConnectionStrings:PhonesConn.ProviderName %>" SelectCommand="SELECT TOP 5 Videos.VideoID, Videos.VideoLink, Videos.VideoTitle, Videos.VideoDescription, Videos.DateUploaded, Videos.TimeUploaded, COUNT(Video_Views_Stats.ID) AS [Total Views] FROM (Video_Views_Stats INNER JOIN Videos ON Video_Views_Stats.VideoID = Videos.VideoID) GROUP BY Videos.VideoID, Videos.VideoLink, Videos.VideoTitle, Videos.VideoDescription, Videos.DateUploaded, Videos.TimeUploaded ORDER BY COUNT(Video_Views_Stats.ID) DESC">
        </asp:SqlDataSource>
        &nbsp;</p>
</asp:Content>
